using System;
using System.Data;
using System.Xml;

using OR.Reuse.Persistence;

using Derived = OR.Lazarus.Business.Entities.Log;

namespace OR.Lazarus.Business.Entities.Log.Lazarus
{
	/// <summary>
	/// Defines attributes about the files generated in a Compilation.
	/// </summary>
   public class CompiledTargetDetail : EntityBase
   {
		protected System.String mName;
		protected System.String mPath;
		protected System.Int32 mFileCount;
		protected System.Int32 mSize;

		public CompiledTargetDetail()
		{
	
		}
	
		/// <summary>
		/// 
		/// </summary>
		public System.String Name
		{
			get
			{
				return ( mName );
			}
			set
			{
				mName = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public System.String Path
		{
			get
			{
				return ( mPath );
			}
			set
			{
				mPath = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public System.Int32 FileCount
		{
			get
			{
				return ( mFileCount );
			}
			set
			{
				mFileCount = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public System.Int32 Size
		{
			get
			{
				return ( mSize );
			}
			set
			{
				mSize = value;
			}
		}

		public override void LoadXml( XmlElement pSource )
		{
			// Scalar Values
			mName = DataUtility.GetString( pSource, "name" );
			mPath = DataUtility.GetString( pSource, "path" );
			mFileCount = DataUtility.GetInt32( pSource, "file-count", 0 );
			mSize = DataUtility.GetInt32( pSource, "size", 0 );
		}
		
		public override XmlElement SaveXml( XmlDocument p_docContext )
		{
			XmlElement vNewElement	= p_docContext.CreateElement( "lzl", "compiled-target", "http://schemas.icitadel.com/Lazarus/Log.xsd" );

			// Scalar Values
			if ( !String.IsNullOrEmpty( mName ) )
			{
				vNewElement.SetAttribute( "name", mName );
			}
					
			if ( !String.IsNullOrEmpty( mPath ) )
			{
				vNewElement.SetAttribute( "path", mPath );
			}
					
			vNewElement.SetAttribute( "file-count", mFileCount.ToString() );
			vNewElement.SetAttribute( "size", mSize.ToString() );

			return ( vNewElement );
		}

		public virtual object Clone()
		{
			Derived.CompiledTargetDetail v_oReturn = new Derived.CompiledTargetDetail();
			
			v_oReturn.Name = mName;
			v_oReturn.Path = mPath;
			v_oReturn.FileCount = mFileCount;
			v_oReturn.Size = mSize;
			
			// FK Values

			// Collections
			
			return ( v_oReturn );
		}

		public virtual Derived.CompiledTargetDetail CloneTyped()
		{
			return ( ( Derived.CompiledTargetDetail )this.Clone() );
		}
   }
}
   